// https://leetcode.cn/problems/hamming-distance/
// Created by ade on 2022/8/5.
//
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    int hammingDistance(int x, int y) {
        return __builtin_popcount(x ^ y);
    }

    int hammingDistance(int x, int y) {
        x = x ^ y;
        int count = 0;
        while (x) {
            count += x & 1;
            x >>= 1;
        }
        return count;
    }
};